{? if $isnotempty ?}
<div id="contest_search">
	<form  action="/soj/php/manager/manager_contest_search.php" method="post">
		<label for="search">search:</label>
		<input type="text" name="search" class="search_text"/>
		<label for="search_option">with</label>
		<select name="option">
			<option value="no">contest_no</option>
			<option value="name">name</option>
		</select>
		<input type="submit" value="search" />
	</form>
</div>
{?* 大于30个结果才会使用置顶的导航栏 *?}
	{? if $contest_num >= 30 ?}
	<div id="pager">
	{? $links ?}
	</div> 
  {? /if ?}
  <table bgcolor="#00CCCC">
  {? if $contest_num ?}
	<caption>竞赛总数 : {? $contest_num ?}</caption>
    {? /if ?}
   <tr>
       {?* 为了实现灵活性，第一个foreach显示所有的标题，这样即便结果集发生了变化，模板文件也不需要修改 *?}
	<tr>
	{? if $titles|@is_array ?}
			{? foreach key=key item=title from=$titles ?}
				{? if $title eq "contest_no" ?}
					<th class="contest_no_th">竞赛编号.</th>
				{? else ?}
					{? if $title eq "name" ?}
						<th class="name">竞赛名</th>
					{? else ?}
						{? if $title eq "status" ?}						
							<th class="status">状态</th>							
						
						{? /if ?}
					{? /if ?}
				{? /if ?}
			{? /foreach ?}
		{? else ?}
			{? "error" ?}
	{? /if ?}
        <th></th><th></th><th></th><th></th><th></th><th></th><th></th>
	</tr>
{?* 设置一个指示变量,用来生成条文表格 *?}
	{? assign var=spec value=0 ?}
	{? if $contests|@is_array ?}
		{? foreach key=key item=contest from=$contests ?}
			{? assign var=spec value=$spec+1 ?}
			
			<tr {? if $spec%2 eq 0 ?} class="spec" {? /if ?}>
				
				{? foreach key=key item=item from=$contest ?}
					{? if $key eq "contest_no" ?}
						{? assign var="no" value=$item ?}					
						<td>{? $item ?}</td>				
					{? else ?}
						{? if $key eq "name" ?}
						
							<td>{? $item ?}</td>
						
						{? else ?}
							
							{? if $key eq "status" ?}
							{? assign var="status" value=$item ?}			
								<td>{? $item ?}</td>							
							
							{? /if ?}
						{? /if ?}
					{? /if ?}					
				{? /foreach ?}	
                <td>
    		     {? if $status eq "no" ?}
				 未开启 no
				 {? else ?}
				   <a href="/soj/php/manager/manager_contest_change_status.php?no={? $no ?}&status=no">未开启 no</a>
				 {? /if ?}				 
				 <td>
                 {? if $status eq "signstart" ?}注册开始 signstart
				 {? else ?}
				  <a href="/soj/php/manager/manager_contest_change_status.php?no={? $no ?}&status=signstart">注册开始 signstart</a>
				 {? /if ?}
                  <td>
				  {? if $status eq "signend" ?}注册结束 signend
				  {? else ?}
				   <a href="/soj/php/manager/manager_contest_change_status.php?no={? $no ?}&status=signend">注册结束 signend</a>
				  {? /if ?}
				 </td>
				  <td>
				  {? if $status eq "start" ?}竞赛开始 start
				  {? else ?}
				   <a href="/soj/php/manager/manager_contest_change_status.php?no={? $no ?}&status=start">竞赛开始 start</a>
				  {? /if ?}
				 </td>
				  <td>
				  {? if $status eq "end" ?}竞赛结束 end
				  {? else ?}
				   <a href="/soj/php/manager/manager_contest_change_status.php?no={? $no ?}&status=end">竞赛开始 end</a>
				  {? /if ?}
				 </td>
				<td class="for manager"><a href="/soj/php/manager/manager_contest_detail.php?no={? $no ?}">管理</a></td>
				<td class="for manager"><a href="/soj/php/manager/manager_contest_delete.php?no={? $no ?}" onClick="return confirm('删除会连同竞赛的试题队伍及队伍结果删除真的要删除?')">删除</a></td>			
				</tr>
		
			{? /foreach ?}
		{? else ?}
			{? "error" ?}
	{? /if ?}
  </table> 
  {? else ?}
  暂时没有竞赛
  {? /if ?}

